<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: discuz_block.php 27449 2012-02-01 05:32:35Z zhangguosheng $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
class collect_hongdougxnewscomcn extends collect_base
{

    public static function getPageContent($url) {   

            //$url='http://www.phplover.cn';   
               
            $pagehtml= utility::DoGet($url);      
       
            $pagehtml = preg_replace("/　/",'',$pagehtml);   
            $pagehtml=iconv("GB2312","UTF-8//IGNORE",$pagehtml);
            //charset   
            if($pageinfo[charset] == '' ) {  
                preg_match('@<meta.+charset=([\w\-]+)[^>]*>@i',$pagehtml,$matches);  
                $pageinfo[charset] = trim($matches[1]);  
            }  
            //desctiption  
            preg_match('@<meta\s+name=\"*description\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  
 
            $desc = trim($matches[1]);  
            $pageinfo[description] = str_replace("\"", '',$desc);  
              
     
            preg_match('@<meta\s+name=\"*keywords\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  

            $keywords = trim($matches[1]);  
            $pageinfo[keywords] = str_replace("\"", '',$keywords);  

              
            preg_match("/<title>(.*)<\/title>/smUi",$pagehtml, $matches);  
            $pageinfo[title] = trim($matches[1]);  
            preg_match("/<body.*>(.*)<\/body>/smUi",$pagehtml, $matches);  


			$pagetitle = $pageinfo['title'];
			$pagetitle = explode('-', $pagetitle);
		    $pageinfo['plate'] = $pagetitle[1];
			$pageinfo['title'] = $pagetitle[0];
			
			preg_match("/<div class=\"authi xg1\">(.*)<\/div>/smUi",$pagehtml, $matches); 
			$authi = $matches[1];
			preg_match("/第([0-9]+)个阅读者/Uisx",$pagehtml, $matches); 
			$pageinfo['views'] = $matches[1];
			
			preg_match("/本帖回复\:\s*([0-9]*)\)<\/span>/Uisx",$pagehtml, $matches);
			$pageinfo['replies'] = $matches[1];
			
			preg_match("/发表于<span\s*style=\"color\:red\"><\/span>&nbsp;([^<>]*)&nbsp;/smUi",$pagehtml, $matches);
		    $pageinfo['dateline'] = $matches[1];
		    
			preg_match("/<META\s*name=\"author\"\s*content=\"([^<>]*)\">/Uisx",$pagehtml, $matches);
		    $pageinfo['author'] = $matches[1];
			
			
			preg_match("/<\!\-\-message\s*start\-\->(.*)<\!\-\-message\s*end\-\->/Uisx",$pagehtml, $matches2);
			
			$pageinfo['message'] = addslashes( self::replaceHtmlAndJs2($matches2[1])); 
            return $pageinfo;  
     
    }  

 	
}
?>